<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1" />
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
    <title>单点登陆</title>
</head>

<body>
    <div style="text-align: center;margin-top: 200px;">单点登陆</div>
    <script type="text/javascript">
        window.onload = function() {
            let geturl = window.location.href
            let getqyinfo = geturl.split('?')[1]
            if (getqyinfo === undefined || getqyinfo.trim() === '') {
                window.location.href = "main.html";
            }else {
                let getqys = getqyinfo.split('&')
                if (getqys === undefined || getqys.length <= 0) {
                    console.log(getqys)
                    return;
                }
                let obj = {}  //创建空对象，接收截取的参数
                for (let i = 0; i < getqys.length; i++) {
                    console.log(i)
                    let item = getqys[i].split('=')
                    let key = item[0]
                    let value = item[1]
                    obj[key] = value
                }
                console.log(obj)
                // 清空 localStorage
                localStorage.clear();
                let token = obj["ScAuth"];
                window.localStorage.setItem("ScAuth", token);
                window.location.href = "main.html";
            }
        };
    </script>
</body>
</html>
